package com.gsh.dao;

import com.gsh.pojo.Voltage;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * 电压记录的DAO
 */
@Mapper
@Repository
public interface VoltageDao {
    //插入数据
    @Insert("insert into tb_voltage(UID,VDate,LDate,MeasuringPoint,ErrType,VMoment,VDataValue,Capacity,FOM) " +
            "values(#{uid},#{vDate},#{lDate},#{measuringPoint},#{errType},#{vMoment},#{vDataValue},#{capacity},#{fom})")
    int insertVoltage(Voltage voltage);

    //批量插入,xml
    int insertBatchVoltage(List<Voltage> voltages);

    //查询，按测量点名称，起始日期和截止日期查询数据
    @Select("select * from tb_voltage where MeasuringPoint=#{measuringPoint} and ErrType=#{errType} and VDate between #{beginDate} and #{endDate} order by vMoment asc")
    List<Voltage> querybyMD(String measuringPoint,int errType, Date beginDate,Date endDate);
}
